import requests from "@/api/request.js";

export const getFriends = (userId) => requests({
    url: `/getFriendList/${userId}`,
    method: 'GET',
})

export const acceptFriendRequest = (receiver_id, sender_id) => requests({
    url: '/acceptFriendRequest',
    method: 'POST',
    data: {receiver_id, sender_id}
})

export const sendFriendRequestTo = (sender_id, receiver_id) => requests({
    url: '/sendFriendRequest',
    method: 'POST',
    data: {sender_id, receiver_id}
})

export const ignoreFriendRequest = (sender_id, receiver_id) => requests({
    url: '/ignoreFriendRequest',
    method: 'POST',
    data: {sender_id, receiver_id}
})

export const checkFriendReqStatus = (sender_id, receiver_id) => requests({
    url: '/checkFriendReqStatus',
    method: 'GET',
    params: {sender_id, receiver_id}
})

export const deleteFriend = (sender_id, receiver_id) =>
    requests({
        url: '/deleteFriend',
        method: 'delete',
        params: {sender_id, receiver_id}
    })

export const checkIfHasFriendRequest = (sender_id, receiver_id) =>
    requests({
        url: '/checkIfHasFriendRequest',
        method: 'GET',
        params: {sender_id, receiver_id}
    })